GUICommandManager Class Reference

#include <GUICommandManager.h>

List of all members.

Public Member Functions

 GUICommandManager (int nUndoLevel=100)
 ~GUICommandManager ()
bool CanUndo () const
bool CanRedo () const
int getUndoLevel () const
void setUndoLevel (int newValue)
bool IsDirty () const
Command * getLastUndoCommand () const
Command * getLastRedoCommand () const
void DoCommand (Command *pCommand)
void Undo ()
void Redo ()
void Clear ()
void SetClean ()
void AddUndo (Command *pCommand)
void AddRedo (Command *pCommand)
void ClearUndoList ()
void ClearRedoList ()
void ClearCommandList (CommandList *pList)

Private Types

typedef list< Command * > CommandList

Private Attributes

CommandList m_undoList
CommandList m_redoList
int m_nUndoLevel
int m_nCleanCount


Detailed Description

A GUICommandManager class.This class is used for managing the undo and redo operations.

Definition at line 5 of file GUICommandManager.h.


Member Typedef Documentation

typedef list<Command* > GUICommandManager::CommandList [private]
 

Definition at line 10 of file GUICommandManager.h.


Constructor & Destructor Documentation

GUICommandManager::GUICommandManager (  int  nUndoLevel = 100  )  [inline]
 

A constructor. Initializes m_nUndoLevel and m_nCleanCount variables.

Parameters:
nUndoLevel an integer argument.

Definition at line 43 of file GUICommandManager.h.

GUICommandManager::~GUICommandManager (   )  [inline]
 

A destructor. Clears m_undoList and m_redoList.

Definition at line 52 of file GUICommandManager.h.

References Clear().


Member Function Documentation

void GUICommandManager::AddRedo (  Command *  pCommand  ) 
 

pushes a Command object to the m_redoList.

Parameters:
pCommand a Command pointer.

Definition at line 107 of file GUICommandManager.cpp.

References m_redoList.

Referenced by Undo().

void GUICommandManager::AddUndo (  Command *  pCommand  ) 
 

pushes a Command object to the m_undoList.

Parameters:
pCommand a Command pointer.

Definition at line 88 of file GUICommandManager.cpp.

References m_nUndoLevel, and m_undoList.

Referenced by DoCommand(), and Redo().

bool GUICommandManager::CanRedo (   )  const
 

a constant member method showing if redo operation can be performed.

Returns:
The emptiness of the m_redoList

Definition at line 8 of file GUICommandManager.cpp.

References m_redoList.

Referenced by OSGWindows::canRedo(), and Redo().

bool GUICommandManager::CanUndo (   )  const
 

a constant member method showing if undo operation can be performed.

Returns:
The emptiness of the m_undoList

Definition at line 2 of file GUICommandManager.cpp.

References m_undoList.

Referenced by OSGWindows::canUndo(), and Undo().

void GUICommandManager::Clear (   ) 
 

clears m_undoList and m_redoList.

Definition at line 76 of file GUICommandManager.cpp.

References ClearRedoList(), and ClearUndoList().

Referenced by OSGWindows::deleteFrame(), and ~GUICommandManager().

void GUICommandManager::ClearCommandList (  CommandList *  pList  ) 
 

clears the given list.

Parameters:
pList a CommandList pointer.

Definition at line 122 of file GUICommandManager.cpp.

Referenced by ClearRedoList(), and ClearUndoList().

void GUICommandManager::ClearRedoList (   ) 
 

clears m_redoList.

Definition at line 117 of file GUICommandManager.cpp.

References ClearCommandList(), and m_redoList.

Referenced by Clear(), and DoCommand().

void GUICommandManager::ClearUndoList (   ) 
 

clears m_undoList.

Definition at line 112 of file GUICommandManager.cpp.

References ClearCommandList(), and m_undoList.

Referenced by Clear().

void GUICommandManager::DoCommand (  Command *  pCommand  ) 
 

execute the command and add it to undo list if succeeded.

Parameters:
pCommand a Command pointer.

Definition at line 39 of file GUICommandManager.cpp.

References AddUndo(), ClearRedoList(), and Command::execute().

Referenced by OSGWindows::addCommandCut(), OSGWindows::addCommandDelete(), OSGWindows::addCommandInsertEnvObj(), OSGWindows::addCommandInsertTrafficLight(), OSGWindows::addCommandInsertTrafficSign(), OSGWindows::addCommandInsertVehicle(), OSGWindows::addCommandPaste(), OSGWindows::addCommandRotate(), and OSGWindows::addCommandTranslate().

Command * GUICommandManager::getLastRedoCommand (   )  const
 

a constant member method returning the first redoable command object.

Returns:
The first redoable command object

Definition at line 34 of file GUICommandManager.cpp.

References m_redoList.

Command * GUICommandManager::getLastUndoCommand (   )  const
 

a constant member method returning the last performed command object.

Returns:
The last performed command object

Definition at line 29 of file GUICommandManager.cpp.

References m_undoList.

int GUICommandManager::getUndoLevel (   )  const
 

a constant member method returning the maximum undo level.

Returns:
The value of the m_nUndoLevel

Definition at line 14 of file GUICommandManager.cpp.

References m_nUndoLevel.

bool GUICommandManager::IsDirty (   )  const
 

a constant member method showing if any command operation is performed.

Returns:
The m_nCleanCount size

Definition at line 24 of file GUICommandManager.cpp.

References m_nCleanCount.

Referenced by OSGWindows::isModified().

void GUICommandManager::Redo (   ) 
 

performs redo operation to the first redoable command object.

Definition at line 62 of file GUICommandManager.cpp.

References AddUndo(), CanRedo(), Command::execute(), m_nCleanCount, and m_redoList.

Referenced by OSGWindows::redo().

void GUICommandManager::SetClean (   ) 
 

set m_nCleanCount as 0.

Definition at line 83 of file GUICommandManager.cpp.

References m_nCleanCount.

void GUICommandManager::setUndoLevel (  int  newValue  ) 
 

set the maximum undo level.

Parameters:
newValue an integer argument.

Definition at line 19 of file GUICommandManager.cpp.

References m_nUndoLevel.

Referenced by OSGWindows::OSGWindows().

void GUICommandManager::Undo (   ) 
 

performs undo operation to the last performed command operation.

Definition at line 48 of file GUICommandManager.cpp.

References AddRedo(), CanUndo(), m_nCleanCount, m_undoList, and Command::unexecute().

Referenced by OSGWindows::undo().


Member Data Documentation

int GUICommandManager::m_nCleanCount [private]
 

a private variable. It holds if any command operation is performed.

Definition at line 34 of file GUICommandManager.h.

Referenced by IsDirty(), Redo(), SetClean(), and Undo().

int GUICommandManager::m_nUndoLevel [private]
 

a private variable. It holds maximum size of the m_undoList.

Definition at line 28 of file GUICommandManager.h.

Referenced by AddUndo(), getUndoLevel(), and setUndoLevel().

CommandList GUICommandManager::m_redoList [private]
 

a private list of Command pointers. It holds the command objects on which redo operations can be performed.

Definition at line 22 of file GUICommandManager.h.

Referenced by AddRedo(), CanRedo(), ClearRedoList(), getLastRedoCommand(), and Redo().

CommandList GUICommandManager::m_undoList [private]
 

a private list of Command pointers. It holds the command objects on which undo operations can be performed.

Definition at line 16 of file GUICommandManager.h.

Referenced by AddUndo(), CanUndo(), ClearUndoList(), getLastUndoCommand(), and Undo().


The documentation for this class was generated from the following files:
Generated on Sun May 28 18:54:13 2006 for TraffEdu by  doxygen 1.4.6-NO